package com.gopay.common.cps.dao.gp.impl;

import java.io.Serializable;
import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.gopay.common.base.dao.impl.BaseDAOImpl;
import com.gopay.common.cps.dao.gp.CpsGpTrustRiskRelDAO;
import com.gopay.common.domain.cps.gp.CpsGpContractInfo;
import com.gopay.common.domain.cps.gp.CpsGpTrustRiskRel;

/**
 * P2P平台托管与风险金关系
 * 
 * @CpsGpTrustRiskRelDAOImpl.java
 * @author lizheng
 * @2014-4-24 上午11:59:51 www.gopay.com.cn Inc.All rights reserved.
 */
@Repository("cpsGpTrustRiskRelDAO")
public class CpsGpTrustRiskRelDAOImpl extends BaseDAOImpl<CpsGpTrustRiskRel, Serializable> implements
        CpsGpTrustRiskRelDAO {
    @Override
    public CpsGpTrustRiskRel getByCustIdAndTrustAcct(String custId, String trustAcct) {
        DetachedCriteria criteria = DetachedCriteria.forClass(CpsGpTrustRiskRel.class);
        criteria.add(Restrictions.eq("custId", custId));
        criteria.add(Restrictions.eq("trustAcct", trustAcct));
        List<CpsGpTrustRiskRel> list = this.findByCriteria(criteria);
        return list.size() > 0 ? list.get(0) : null;
    }
}
